<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>活动管理</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <link rel="stylesheet" href="{{ asset('assets/css/bootstrap.min.css')}}">
    <link rel="stylesheet" href="{{ asset('css/indexBo.css')}}">
    <link rel="stylesheet" href="{{ asset('assets/css/ace.min.css')}}">
    <link rel="stylesheet" href="{{ asset('assets/css/ace-rtl.min.css')}}">
    <link rel="stylesheet" href="{{ asset('assets/css/ace-skins.min.css')}}">

    <link rel="stylesheet" type="text/css" href="{{ asset('assets/css/font-awesome.min.css')}}" />

    <!-- basic styles -->

    <link href="" rel="stylesheet" />
    <link rel="stylesheet" href="" />

    <!--[if IE 7]>
    <link rel="stylesheet" href="assets/css/font-awesome-ie7.min.css" />
    <![endif]-->

    <!-- page specific plugin styles -->

    <!-- fonts -->

    <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:400,300" />

    <!-- ace styles -->

    <link rel="stylesheet" href="" />
    <link rel="stylesheet" href="" />
    <link rel="stylesheet" href="" />

    <!--[if lte IE 8]>
    <link rel="stylesheet" href="assets/css/ace-ie.min.css" />
    <![endif]-->
    <style>
        .addActive{
            display: inline-block;
            width: 80px;
            height: 30px;
            line-height: 30px;
            background:#0d5ab1;
            color: #fff;
            font-size: 16px;
            font-weight: bold;
            text-align: center;
            cursor: pointer;
            margin-left: 5px;
        }
    </style>
    <!-- inline styles related to this page -->

    <!-- ace settings handler -->

    <script src="{{ asset('assets/js/ace-extra.min.js')}}"></script>

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->

    <!--[if lt IE 9]>
    <script src="assets/js/html5shiv.js"></script>
    <script src="assets/js/respond.min.js"></script>
    <![endif]-->

</head>

<body>
<div class="navbar navbar-default" id="navbar">
    <script type="text/javascript">
        try{ace.settings.check('navbar' , 'fixed')}catch(e){}
    </script>

    <div class="navbar-container" id="navbar-container">
        <div class="navbar-header pull-left">
            <a href="#" class="navbar-brand">
                <small>
                    <i class="icon-leaf"></i>
                    摄影平台后台管理系统
                </small>
            </a><!-- /.brand -->
        </div><!-- /.navbar-header -->

        <div class="navbar-header pull-right" role="navigation">
            <ul class="nav ace-nav">
                <li class="light-blue">
                    <a data-toggle="dropdown" href="#" class="dropdown-toggle">
                        <img class="headPic" src="{{ asset('assets/avatars/user.jpg')}}">
                        <span class="user-info">
									<small>Welcome,</small>
									Jason
								</span>

                        <i class="icon-caret-down"></i>
                    </a>

                    <ul class="user-menu pull-right dropdown-menu dropdown-yellow dropdown-caret dropdown-close">

                        <li class="divider"></li>

                        <li>
                            <a href="#">
                                <i class="icon-off"></i>
                                退出
                            </a>
                        </li>
                    </ul>
                </li>
            </ul><!-- /.ace-nav -->
        </div><!-- /.navbar-header -->
    </div><!-- /.container -->
</div>

<div class="main-container" id="main-container">
    <script type="text/javascript">
        try{ace.settings.check('main-container' , 'fixed')}catch(e){}
    </script>

    <div class="main-container-inner">
        <a class="menu-toggler" id="menu-toggler" href="#">
            <span class="menu-text"></span>
        </a>

        <div class="sidebar" id="sidebar">
            <script type="text/javascript">
                try{ace.settings.check('sidebar' , 'fixed')}catch(e){}
            </script>

            <ul class="nav nav-list">
                <li>
                    <a href="picManage.html">
                        <i class="icon-dashboard"></i>
                        用户上传图片管理
                    </a>
                </li>
                <li  class="active">
                    <a href="active">
                        <i class="icon-double-angle-right"></i>
                        照片管理
                    </a>
                </li>
                <li  class="active">
                    <a href="photo">
                        <i class="icon-double-angle-right"></i>
                        活动管理
                    </a>
                </li>
            </ul><!-- /.nav-list -->

        </div>

        <div class="main-content">
            <div class="breadcrumbs" id="breadcrumbs">
                <script type="text/javascript">
                    try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
                </script>


                <div class="nav-search" id="nav-search">
                    <form class="form-search">
								<span class="input-icon">
									<input type="text" placeholder="Search ..." class="nav-search-input" id="nav-search-input" autocomplete="off" />
									<i class="icon-search nav-search-icon"></i>
								</span>
                    </form>
                </div><!-- #nav-search -->
            </div>

            <div class="page-content">
                <div class="page-header">
                    <h1 style="float: left;">
                        活动管理
                    </h1>
                    <span class="addActive"><a href="{{ url('admin/ace/addActive') }}">添加活动</a></span>
                </div><!-- /.page-header -->
                @if (count($errors) > 0)
                    <div class="alert alert-danger">
                        <ul>
                            @foreach ($errors->all() as $error)
                                <li>{{ $error }}</li>
                            @endforeach
                            
                        </ul>
                    </div>
                @endif
                @if(session('info'))
                    <p class="text-red">{{session('info')}}</p>
                @endif
                <div class="row">
                    <div class="col-xs-12">
                        <div class="table-responsive">
                            <table id="sample-table-1" class="table table-striped table-bordered table-hover">

                                <thead>
                                <tr>

                                    <th>ID</th>
                                    <th>活动名称</th>
                                    <th>开启人</th>
                                    <th>
                                        <i class="icon-time bigger-110 hidden-480"></i>
                                        开启时间
                                    </th>
                                    <th>
                                        <i class="icon-time bigger-110 hidden-480"></i>
                                        结束时间
                                    </th>
                                    <th class="hidden-480">状态</th>
                                    <th>操作</th>
                                </tr>
                                </thead>

                                <tbody>
                                @foreach($data as $v)
                                <tr>
                                    <td>{{ $v -> id }}</td>
                                    <td>{{ $v -> activename }}</td>
                                    <td class="hidden-480">
                                        {{ $v -> uname }}
                                    </td>
                                    <td>{{ $v -> active_at }}</td>
                                    <td>{{ $v -> active_out }}</td>
                                    <td class="hidden-480">
                                        <span class="label label-sm label-success">
                                        <?php 
                                            $time = date('Y-m-d H:i:s',time());
                                        if($v -> active_out > $time && $v -> state == '2')
                                              {
                                        ?>
                                            提前结束
                                        <?php
                                              }elseif($v -> active_out < $time && $v -> state == '1')
                                              {
                                        ?>
                                            <font color="red">!活动已超时，请注意</font>
                                        <?php
                                              }elseif($v -> state == '0')
                                              {
                                        ?>
                                            活动未开始
                                        <?php
                                            }elseif($v -> state == '2')
                                            {
                                        ?>
                                            活动已结束
                                        <?php

                                            }elseif($v -> state == '1')
                                            {
                                        ?>
                                            进行中
                                        <?php
                                              }
                                        ?>
                                        </span>
                                    </td>
                                    <td>
                                        <a href="{{ url('admin/ace/photo/edit') }}/{{ $v -> id }}">提前结束</a>
                                        <a href="{{ url('admin/ace/photo/del') }}/{{ $v -> id }}">删除</a>
                                    </td>
                                    <!-- <td>

                                         <div class="visible-md visible-lg hidden-sm hidden-xs btn-group">

                                            <button class="btn btn-xs btn-info">
                                                <i id="edit" did="{{ $v -> id }}" class="icon-edit bigger-120"><a href="{{ url('admin/ace/update') }}?id={{ $v -> id }}"><font color="#F4F4F4">通过</font></a></i>
                                            </button>

                                            <button class="btn btn-xs btn-danger">
                                                <i class="icon-trash bigger-120"><a href=""><font color="#F4F4F4">删除</font></a></i>
                                            </button>

                                        </div>
                                    </td> -->
                                </tr>
                                @endforeach
                                
                                </tbody>

                            </table>
                            {{ $data -> appends($request) -> links() }}
                        </div><!-- /.table-responsive -->
                    </div><!-- /span -->
                </div><!-- /row -->


            </div><!-- /.page-content -->
        </div><!-- /.main-content -->

        <div class="ace-settings-container" id="ace-settings-container">
            <div class="btn btn-app btn-xs btn-warning ace-settings-btn" id="ace-settings-btn">
                <i class="icon-cog bigger-150"></i>
            </div>

            <div class="ace-settings-box" id="ace-settings-box">
                <div>
                    <div class="pull-left">
                        <select id="skin-colorpicker" class="hide">
                            <option data-skin="default" value="#438EB9">#438EB9</option>
                            <option data-skin="skin-1" value="#222A2D">#222A2D</option>
                            <option data-skin="skin-2" value="#C6487E">#C6487E</option>
                            <option data-skin="skin-3" value="#D0D0D0">#D0D0D0</option>
                        </select>
                    </div>
                    <span>&nbsp; Choose Skin</span>
                </div>

                <div>
                    <input type="checkbox" class="ace ace-checkbox-2" id="ace-settings-navbar" />
                    <label class="lbl" for="ace-settings-navbar"> Fixed Navbar</label>
                </div>

                <div>
                    <input type="checkbox" class="ace ace-checkbox-2" id="ace-settings-sidebar" />
                    <label class="lbl" for="ace-settings-sidebar"> Fixed Sidebar</label>
                </div>

                <div>
                    <input type="checkbox" class="ace ace-checkbox-2" id="ace-settings-breadcrumbs" />
                    <label class="lbl" for="ace-settings-breadcrumbs"> Fixed Breadcrumbs</label>
                </div>

                <div>
                    <input type="checkbox" class="ace ace-checkbox-2" id="ace-settings-rtl" />
                    <label class="lbl" for="ace-settings-rtl"> Right To Left (rtl)</label>
                </div>

                <div>
                    <input type="checkbox" class="ace ace-checkbox-2" id="ace-settings-add-container" />
                    <label class="lbl" for="ace-settings-add-container">
                        Inside
                        <b>.container</b>
                    </label>
                </div>
            </div>
        </div><!-- /#ace-settings-container -->
    </div><!-- /.main-container-inner -->

    <a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
        <i class="icon-double-angle-up icon-only bigger-110"></i>
    </a>
</div><!-- /.main-container -->

<!-- basic scripts -->


<!--[if !IE]> -->

<!-- <script type="text/javascript">
    window.jQuery || document.write("<script src=''>"+"<"+"/script>");
</script> -->
<script src="{{ asset('assets/js/jquery-2.0.3.min.js')}}"></script>

<!-- <![endif]-->

<!--[if IE]>
<script type="text/javascript">
    window.jQuery || document.write("<script src='assets/js/jquery-1.10.2.min.js'>"+"<"+"/script>");
</script>
<![endif]-->

<!-- page specific plugin scripts -->
<script src="{{ asset('assets/js/bootstrap.min.js')}}"></script>
<script src="{{ asset('assets/js/typeahead-bs2.min.js')}}"></script>

<!-- ace scripts -->
<script src="{{ asset('assets/js/jquery.dataTables.min.js')}}"></script>
<script src="{{ asset('assets/js/jquery.dataTables.bootstrap.js')}}"></script>

<!-- inline scripts related to this page -->
<script src="{{ asset('assets/js/ace-elements.min.js')}}"></script>
<script src="{{ asset('assets/js/ace.min.js')}}"></script>

<script type="text/javascript">
    jQuery(function($) {
        var oTable1 = $('#sample-table-2').dataTable( {
            "aoColumns": [
                { "bSortable": false },
                null, null,null, null, null,
                { "bSortable": false }
            ] } );


        $('table th input:checkbox').on('click' , function(){
            var that = this;
            $(this).closest('table').find('tr > td:first-child input:checkbox')
                .each(function(){
                    this.checked = that.checked;
                    $(this).closest('tr').toggleClass('selected');
                });

        });


        $('[data-rel="tooltip"]').tooltip({placement: tooltip_placement});
        function tooltip_placement(context, source) {
            var $source = $(source);
            var $parent = $source.closest('table')
            var off1 = $parent.offset();
            var w1 = $parent.width();

            var off2 = $source.offset();
            var w2 = $source.width();

            if( parseInt(off2.left) < parseInt(off1.left) + parseInt(w1 / 2) ) return 'right';
            return 'left';
        }
    })
</script>
<div style="display:none"><script src="{{ url('http://v7.cnzz.com/stat.php?id=155540&web_id=155540')}}"></script></div>

</body>
</html>
